<template>
	<view class="warp">
		<xw-empty v-if="httpFlag == true" :isShow="emptyShow" text="暂无关注" textColor="#777777"></xw-empty>
		<view class="userList" v-for="(el,index) in userList" :key="index" @click="getUserInfo(el,index)">
			<image :src="el.userItem.profile_photo" mode=""></image>
			<view class="text">
				{{el.userItem.name}}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getConcern
	} from '../../module/index.js'
	import xwEmpty from '@/components/xw-empty/xw-empty';
	export default {
		components: {
			xwEmpty
		},
		data() {
			return {
				title: "",
				userList: [],
				emptyShow: true, //true显示，false隐藏,
				httpFlag: false

			}
		},
		onLoad(option) {},
		onShow() {
			this.getConcern()
		},
		methods: {
			getConcern() {
				//发起请求
				getConcern().then((res) => {
					if (res.code === 200) {
						console.log(res)
						this.userList = res.data.data
						if (this.userList.length <= 0) {
							this.emptyShow = true
						} else {
							this.emptyShow = false
						}
						this.httpFlag = true
					} else {
						uni.showToast({
							title: res.message,
							icon: "none"
						})
					}
				}).catch(err => {
					console.log(err)
				})
			},
			getUserInfo(el, index) {
				if (el.userItem.type == 1) {
					uni.navigateTo({
						url: `/wxcomponents/createdWarpCopy/index?id=` + el.admin_id
					});
				} else {
					uni.navigateTo({
						url: `/wxcomponents/lifePage/index?id=` + el.admin_id
					});
				}
			}
		}
	}
</script>

<style scoped>
	.warp {
		padding: 0px 12rpx;
		box-sizing: border-box;
	}

	.userList {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin: 20rpx 0rpx;
	}

	image {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		border: 1px solid #4CD964;
	}

	.text {
		color: #1d1d1d;
		text-align: center;
	}
</style>
